class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: D = None
        self.r: F = None
        self.o: F = None
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: A = None
        self.q: C = None
        self.o: B = None
        self.u: D = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.txt = txt

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

c = A("c")
l = B("l")
g = C("g")
b = D("b")
f = E("f")
a = F("a")
j = B("j")

c.t = f
c.q = b
c.r = a
c.o = a
c.z = a
l.z = b
l.u = b
l.t = b
l.y = c
l.q = g
l.o = j
g.x = a
g.z = l
b.z = f
f.r = a
f.p = b
a.u = g
a.v = g
j.z = b
j.u = b
j.t = b
j.y = c
j.q = g
j.o = l
assert b.z.r.v.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: D = None
        self.r: F = None
        self.o: F = None
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: A = None
        self.q: C = None
        self.o: B = None
        self.u: D = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.txt = txt

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

c = A("c")
l = B("l")
g = C("g")
b = D("b")
f = E("f")
a = F("a")
j = B("j")

c.t = f
c.q = b
c.r = a
c.o = a
c.z = a
l.z = b
l.u = b
l.t = b
l.y = c
l.q = g
l.o = j
g.x = a
g.z = l
b.z = f
f.r = a
f.p = b
a.u = g
a.v = g
j.z = b
j.u = b
j.t = b
j.y = c
j.q = g
j.o = l
assert b.z.r.v.z.q.txt == "g"