class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.r: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

c.y = j
c.u = d
c.r = n
c.q = n
d.u = i
d.w = i
d.t = c
d.x = j
d.q = k
a.y = n
a.x = h
a.t = i
k.u = l
k.t = h
i.w = c
i.y = k
n.q = h
l.u = k
l.t = h
h.y = n
h.x = a
h.t = i
j.u = i
j.w = i
j.t = c
j.x = d
j.q = l
assert h.x.x.y.q.y.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.r: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

c.y = j
c.u = d
c.r = n
c.q = n
d.u = i
d.w = i
d.t = c
d.x = j
d.q = k
a.y = n
a.x = h
a.t = i
k.u = l
k.t = h
i.w = c
i.y = k
n.q = h
l.u = k
l.t = h
h.y = n
h.x = a
h.t = i
j.u = i
j.w = i
j.t = c
j.x = d
j.q = l
assert h.x.x.y.q.y.q.t.txt == "i"