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

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

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

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

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

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

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

b.t = h
n.w = k
n.r = a
n.o = b
n.t = h
k.v = n
k.p = h
a.q = h
a.s = k
a.v = n
h.u = k
h.q = b
h.x = n
l.o = n
l.r = k
assert b.t.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

b.t = h
n.w = k
n.r = a
n.o = b
n.t = h
k.v = n
k.p = h
a.q = h
a.s = k
a.v = n
h.u = k
h.q = b
h.x = n
l.o = n
l.r = k
assert b.t.u.p.u.txt == "k"