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

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

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

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

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

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

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

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

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

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

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

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

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

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

c.r = h
c.t = g
c.v = b
c.y = b
a.x = b
a.u = c
a.p = g
a.z = g
a.v = g
e.z = c
b.u = h
h.p = a
g.q = h
l.r = h
l.t = g
l.v = b
l.y = b
assert c.v.u.p.u.t.q.p.txt == "a"