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

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

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

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

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

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

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

i.p = l
i.s = h
j.w = h
j.u = l
j.t = d
d.w = a
d.y = l
d.z = i
h.t = a
l.u = d
a.q = j
a.z = d
e.w = h
e.u = l
e.t = d
assert d.z.p.u.y.u.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

i.p = l
i.s = h
j.w = h
j.u = l
j.t = d
d.w = a
d.y = l
d.z = i
h.t = a
l.u = d
a.q = j
a.z = d
e.w = h
e.u = l
e.t = d
assert d.z.p.u.y.u.z.p.txt == "l"