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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
f = C("f")
k = D("k")
e = E("e")
c = F("c")
d = B("d")
n = C("n")

h.u = k
h.p = d
j.x = d
j.z = h
j.p = c
j.r = e
f.z = n
k.p = e
k.w = e
k.q = e
k.y = e
e.r = h
c.p = h
c.v = j
c.z = f
d.x = j
d.z = h
d.p = c
d.r = e
n.z = f
assert e.r.p.z.p.p.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
f = C("f")
k = D("k")
e = E("e")
c = F("c")
d = B("d")
n = C("n")

h.u = k
h.p = d
j.x = d
j.z = h
j.p = c
j.r = e
f.z = n
k.p = e
k.w = e
k.q = e
k.y = e
e.r = h
c.p = h
c.v = j
c.z = f
d.x = j
d.z = h
d.p = c
d.r = e
n.z = f
assert e.r.p.z.p.p.v.r.txt == "e"