class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: C = None
        self.txt = txt

e = A("e")
f = B("f")
b = C("b")
c = D("c")
a = A("a")
h = B("h")

e.v = b
e.y = b
e.s = c
f.u = a
f.y = h
b.o = a
b.s = a
b.t = e
c.s = b
c.o = b
a.v = b
a.y = b
a.s = c
h.u = a
h.y = f
assert c.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: C = None
        self.txt = txt

e = A("e")
f = B("f")
b = C("b")
c = D("c")
a = A("a")
h = B("h")

e.v = b
e.y = b
e.s = c
f.u = a
f.y = h
b.o = a
b.s = a
b.t = e
c.s = b
c.o = b
a.v = b
a.y = b
a.s = c
h.u = a
h.y = f
assert c.s.s.s.txt == "c"