class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.q: E = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: D = None
        self.q: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.q: C = None
        self.z: A = None
        self.txt = txt

f = A("f")
a = B("a")
h = C("h")
b = D("b")
e = E("e")
k = F("k")
c = D("c")
i = A("i")

f.o = i
f.r = c
f.q = e
f.x = e
f.v = k
a.t = h
h.x = a
h.z = c
h.q = c
b.p = k
e.p = i
k.v = e
k.r = h
k.q = h
k.z = i
c.p = k
i.o = f
i.r = b
i.q = e
i.x = e
i.v = k
assert k.r.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.q: E = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: D = None
        self.q: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.q: C = None
        self.z: A = None
        self.txt = txt

f = A("f")
a = B("a")
h = C("h")
b = D("b")
e = E("e")
k = F("k")
c = D("c")
i = A("i")

f.o = i
f.r = c
f.q = e
f.x = e
f.v = k
a.t = h
h.x = a
h.z = c
h.q = c
b.p = k
e.p = i
k.v = e
k.r = h
k.q = h
k.z = i
c.p = k
i.o = f
i.r = b
i.q = e
i.x = e
i.v = k
assert k.r.x.t.x.t.txt == "h"