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

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

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

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

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

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

l = A("l")
a = B("a")
e = C("e")
g = D("g")
c = E("c")
j = F("j")

l.t = a
a.t = g
a.w = g
e.o = c
e.w = g
g.t = a
g.w = c
c.w = l
c.q = g
j.u = c
j.p = c
j.v = g
j.o = l
assert c.w.t.t.t.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

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

l = A("l")
a = B("a")
e = C("e")
g = D("g")
c = E("c")
j = F("j")

l.t = a
a.t = g
a.w = g
e.o = c
e.w = g
g.t = a
g.w = c
c.w = l
c.q = g
j.u = c
j.p = c
j.v = g
j.o = l
assert c.w.t.t.t.w.w.txt == "c"