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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: D = None
        self.txt = txt

c = A("c")
f = B("f")
j = C("j")
a = D("a")
m = E("m")
n = F("n")
i = C("i")

c.x = m
c.s = m
c.y = j
c.z = j
f.x = i
j.y = i
j.t = n
a.z = c
m.t = c
n.y = j
n.r = a
i.y = j
i.t = n
assert n.r.z.x.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: C = None
        self.z: C = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: D = None
        self.txt = txt

c = A("c")
f = B("f")
j = C("j")
a = D("a")
m = E("m")
n = F("n")
i = C("i")

c.x = m
c.s = m
c.y = j
c.z = j
f.x = i
j.y = i
j.t = n
a.z = c
m.t = c
n.y = j
n.r = a
i.y = j
i.t = n
assert n.r.z.x.t.z.txt == "j"