class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: E = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

e = A("e")
n = B("n")
d = C("d")
g = D("g")
b = E("b")
j = F("j")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

e = A("e")
n = B("n")
d = C("d")
g = D("g")
b = E("b")
j = F("j")

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