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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: F = None
        self.r: F = None
        self.txt = txt

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

l = A("l")
d = B("d")
b = C("b")
i = D("i")
c = E("c")
j = F("j")
h = C("h")

l.t = d
l.y = i
l.w = i
d.w = i
d.q = l
b.w = i
i.w = d
i.s = j
c.o = j
c.t = j
c.r = j
j.s = i
j.p = i
j.t = c
h.w = i
assert d.w.s.t.r.s.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: D = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: F = None
        self.r: F = None
        self.txt = txt

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

l = A("l")
d = B("d")
b = C("b")
i = D("i")
c = E("c")
j = F("j")
h = C("h")

l.t = d
l.y = i
l.w = i
d.w = i
d.q = l
b.w = i
i.w = d
i.s = j
c.o = j
c.t = j
c.r = j
j.s = i
j.p = i
j.t = c
h.w = i
assert d.w.s.t.r.s.w.q.txt == "l"