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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.txt = txt

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

i.y = l
i.x = h
c.q = l
a.r = c
a.q = l
a.z = k
h.t = l
h.v = c
l.p = c
l.o = i
l.t = i
k.x = h
k.s = c
assert k.x.v.q.p.q.txt == "l"