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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
h = C("h")
f = D("f")
k = E("k")
g = F("g")
b = D("b")

j.y = b
j.u = h
m.t = k
m.x = h
h.p = m
f.t = j
k.p = b
g.q = j
g.w = k
g.t = m
b.t = j
assert m.x.p.t.p.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
h = C("h")
f = D("f")
k = E("k")
g = F("g")
b = D("b")

j.y = b
j.u = h
m.t = k
m.x = h
h.p = m
f.t = j
k.p = b
g.q = j
g.w = k
g.t = m
b.t = j
assert m.x.p.t.p.t.u.txt == "h"