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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: B = None
        self.s: G = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

n = A("n")
d = B("d")
l = C("l")
f = D("f")
k = E("k")
c = F("c")
m = G("m")
b = H("b")
g = F("g")
i = A("i")

n.x = g
n.z = k
n.t = k
d.u = l
d.y = g
l.x = i
l.p = d
l.s = m
l.t = g
f.q = n
f.r = l
k.p = m
k.t = f
c.x = m
m.r = l
b.u = k
g.x = m
i.x = g
i.z = k
i.t = k
assert g.x.r.x.x.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: E = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: B = None
        self.s: G = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

n = A("n")
d = B("d")
l = C("l")
f = D("f")
k = E("k")
c = F("c")
m = G("m")
b = H("b")
g = F("g")
i = A("i")

n.x = g
n.z = k
n.t = k
d.u = l
d.y = g
l.x = i
l.p = d
l.s = m
l.t = g
f.q = n
f.r = l
k.p = m
k.t = f
c.x = m
m.r = l
b.u = k
g.x = m
i.x = g
i.z = k
i.t = k
assert g.x.r.x.x.x.r.txt == "l"