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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.r: C = None
        self.x: B = None
        self.txt = txt

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

l = A("l")
j = B("j")
e = C("e")
a = D("a")
h = E("h")
b = F("b")
c = F("c")

l.z = a
l.v = a
j.p = h
e.y = a
e.u = h
a.p = l
a.u = j
h.p = a
h.s = j
h.x = j
h.r = e
b.v = l
b.y = h
c.v = l
c.y = h
assert h.s.p.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.r: C = None
        self.x: B = None
        self.txt = txt

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

l = A("l")
j = B("j")
e = C("e")
a = D("a")
h = E("h")
b = F("b")
c = F("c")

l.z = a
l.v = a
j.p = h
e.y = a
e.u = h
a.p = l
a.u = j
h.p = a
h.s = j
h.x = j
h.r = e
b.v = l
b.y = h
c.v = l
c.y = h
assert h.s.p.p.u.p.txt == "h"