class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: F = None
        self.p: D = None
        self.t: F = None
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: A = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: A = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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