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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: B = None
        self.txt = txt

g = A("g")
j = B("j")
d = C("d")
l = D("l")
a = E("a")
b = D("b")
m = C("m")
e = A("e")

g.v = l
g.x = l
j.p = g
j.q = g
j.t = b
j.x = d
d.r = m
d.z = m
d.w = a
l.v = g
a.u = b
a.z = j
b.v = g
m.r = d
m.z = d
m.w = a
e.v = l
e.x = b
assert l.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: B = None
        self.txt = txt

g = A("g")
j = B("j")
d = C("d")
l = D("l")
a = E("a")
b = D("b")
m = C("m")
e = A("e")

g.v = l
g.x = l
j.p = g
j.q = g
j.t = b
j.x = d
d.r = m
d.z = m
d.w = a
l.v = g
a.u = b
a.z = j
b.v = g
m.r = d
m.z = d
m.w = a
e.v = l
e.x = b
assert l.v.v.v.v.v.v.v.txt == "g"