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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.p: B = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
n = C("n")
j = D("j")
k = E("k")
g = F("g")
i = E("i")

f.t = j
d.t = k
d.p = g
d.r = n
d.u = j
n.w = f
n.s = g
j.x = k
k.s = i
k.x = i
k.p = d
k.u = j
k.r = n
g.t = f
i.s = k
i.x = k
i.p = d
i.u = j
i.r = n
assert n.s.t.t.x.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.p: B = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
n = C("n")
j = D("j")
k = E("k")
g = F("g")
i = E("i")

f.t = j
d.t = k
d.p = g
d.r = n
d.u = j
n.w = f
n.s = g
j.x = k
k.s = i
k.x = i
k.p = d
k.u = j
k.r = n
g.t = f
i.s = k
i.x = k
i.p = d
i.u = j
i.r = n
assert n.s.t.t.x.u.x.u.txt == "j"