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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: A = None
        self.v: B = None
        self.y: D = None
        self.txt = txt

c = A("c")
n = B("n")
f = C("f")
h = D("h")
e = E("e")
i = F("i")
l = A("l")

c.p = f
c.z = e
c.q = e
c.r = e
n.u = h
n.x = h
n.v = c
f.o = n
f.x = i
h.q = n
h.w = i
h.r = c
e.t = n
e.x = h
e.y = c
e.r = i
i.w = n
i.v = n
i.s = l
i.y = h
l.p = f
l.z = e
l.q = e
l.r = e
assert h.r.q.t.v.z.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: E = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: A = None
        self.v: B = None
        self.y: D = None
        self.txt = txt

c = A("c")
n = B("n")
f = C("f")
h = D("h")
e = E("e")
i = F("i")
l = A("l")

c.p = f
c.z = e
c.q = e
c.r = e
n.u = h
n.x = h
n.v = c
f.o = n
f.x = i
h.q = n
h.w = i
h.r = c
e.t = n
e.x = h
e.y = c
e.r = i
i.w = n
i.v = n
i.s = l
i.y = h
l.p = f
l.z = e
l.q = e
l.r = e
assert h.r.q.t.v.z.x.r.txt == "c"