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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

h.t = k
h.p = b
h.w = b
m.s = i
i.p = k
i.s = k
i.w = m
i.y = h
i.t = b
b.q = m
b.u = m
b.s = k
k.x = j
j.r = i
j.o = i
j.w = i
j.s = m
j.x = k
assert j.r.t.q.s.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

h.t = k
h.p = b
h.w = b
m.s = i
i.p = k
i.s = k
i.w = m
i.y = h
i.t = b
b.q = m
b.u = m
b.s = k
k.x = j
j.r = i
j.o = i
j.w = i
j.s = m
j.x = k
assert j.r.t.q.s.s.x.txt == "j"