class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: F = None
        self.x: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: E = None
        self.z: F = None
        self.o: B = None
        self.s: E = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.t: C = None
        self.q: A = 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.w: C = None
        self.y: B = None
        self.txt = txt

d = A("d")
b = B("b")
c = C("c")
m = D("m")
a = E("a")
h = F("h")

d.v = a
d.q = h
d.x = c
d.r = b
b.r = h
c.p = m
c.y = m
c.v = a
c.s = a
c.z = h
c.o = b
m.w = d
m.q = d
m.y = c
m.t = c
a.p = b
h.w = c
h.y = b
assert c.p.t.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: F = None
        self.x: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: E = None
        self.z: F = None
        self.o: B = None
        self.s: E = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.t: C = None
        self.q: A = 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.w: C = None
        self.y: B = None
        self.txt = txt

d = A("d")
b = B("b")
c = C("c")
m = D("m")
a = E("a")
h = F("h")

d.v = a
d.q = h
d.x = c
d.r = b
b.r = h
c.p = m
c.y = m
c.v = a
c.s = a
c.z = h
c.o = b
m.w = d
m.q = d
m.y = c
m.t = c
a.p = b
h.w = c
h.y = b
assert c.p.t.p.y.txt == "c"