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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: E = None
        self.txt = txt

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

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

c.w = h
c.t = l
e.w = c
e.x = n
n.q = a
h.p = l
h.t = l
h.y = k
h.s = a
a.w = c
a.o = d
k.z = e
g.z = e
b.z = e
l.q = a
d.w = c
d.o = a
assert n.q.o.o.w.t.q.o.w.txt == "c"