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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
d = C("d")
g = D("g")
h = C("h")
j = A("j")

e.y = d
e.v = i
e.t = h
i.q = h
d.u = g
g.s = d
h.u = g
j.y = d
j.v = i
j.t = h
assert g.s.u.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: B = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
d = C("d")
g = D("g")
h = C("h")
j = A("j")

e.y = d
e.v = i
e.t = h
i.q = h
d.u = g
g.s = d
h.u = g
j.y = d
j.v = i
j.t = h
assert g.s.u.s.u.s.txt == "d"