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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
g = C("g")
c = D("c")
a = E("a")
e = F("e")
k = D("k")

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
g = C("g")
c = D("c")
a = E("a")
e = F("e")
k = D("k")

h.v = n
h.t = c
n.y = c
g.x = a
g.o = a
g.w = c
g.q = c
g.v = h
g.r = e
c.s = n
a.r = n
e.x = n
e.p = n
e.z = n
e.y = h
e.u = h
k.s = n
assert k.s.y.s.y.s.y.s.txt == "n"