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

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

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: C = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: A = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

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

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

k.y = a
k.r = a
l.o = e
l.u = e
l.y = h
a.y = h
a.u = e
a.o = c
a.v = c
h.u = e
h.v = e
h.q = a
c.t = a
c.x = k
c.w = k
c.p = l
e.q = h
e.p = k
e.v = c
assert h.q.v.p.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: C = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: A = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

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

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

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