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

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

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

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

b = A("b")
e = B("e")
a = C("a")
g = D("g")
c = B("c")
j = D("j")

b.v = j
e.t = b
e.x = a
a.w = c
a.u = g
a.s = g
g.v = b
g.u = j
c.t = b
c.x = a
j.v = b
j.u = g
assert g.v.v.v.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
a = C("a")
g = D("g")
c = B("c")
j = D("j")

b.v = j
e.t = b
e.x = a
a.w = c
a.u = g
a.s = g
g.v = b
g.u = j
c.t = b
c.x = a
j.v = b
j.u = g
assert g.v.v.v.v.u.u.txt == "j"