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

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

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

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

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

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

h = A("h")
j = B("j")
e = C("e")
c = D("c")
i = E("i")
m = F("m")
k = E("k")
d = F("d")

h.t = e
j.o = k
e.q = i
e.w = i
e.o = h
c.s = h
c.z = e
i.s = j
i.w = j
m.u = j
m.w = d
k.s = j
k.w = j
d.u = j
d.w = m
assert h.t.o.t.o.t.w.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

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

h = A("h")
j = B("j")
e = C("e")
c = D("c")
i = E("i")
m = F("m")
k = E("k")
d = F("d")

h.t = e
j.o = k
e.q = i
e.w = i
e.o = h
c.s = h
c.z = e
i.s = j
i.w = j
m.u = j
m.w = d
k.s = j
k.w = j
d.u = j
d.w = m
assert h.t.o.t.o.t.w.w.o.txt == "k"