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

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

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

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

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

g = A("g")
j = B("j")
i = C("i")
n = D("n")
m = E("m")
a = B("a")
b = E("b")
f = D("f")

g.x = m
j.w = i
j.o = i
j.u = n
j.q = n
j.t = g
i.r = f
n.v = f
n.r = i
n.q = a
n.t = m
m.x = f
m.t = b
a.w = i
a.o = i
a.u = f
a.q = f
a.t = g
b.x = f
b.t = m
f.v = n
f.r = i
f.q = a
f.t = m
assert b.x.r.r.t.t.t.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
i = C("i")
n = D("n")
m = E("m")
a = B("a")
b = E("b")
f = D("f")

g.x = m
j.w = i
j.o = i
j.u = n
j.q = n
j.t = g
i.r = f
n.v = f
n.r = i
n.q = a
n.t = m
m.x = f
m.t = b
a.w = i
a.o = i
a.u = f
a.q = f
a.t = g
b.x = f
b.t = m
f.v = n
f.r = i
f.q = a
f.t = m
assert b.x.r.r.t.t.t.t.x.txt == "f"