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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: E = None
        self.t: E = None
        self.s: C = None
        self.y: E = None
        self.o: F = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
g = C("g")
f = D("f")
j = E("j")
m = F("m")
a = B("a")

h.r = g
h.y = f
h.x = a
b.u = j
b.p = g
g.r = h
g.o = m
g.t = j
g.p = j
g.w = b
f.p = a
f.z = j
f.t = j
f.y = j
f.s = g
f.o = m
j.v = m
j.y = m
j.t = h
j.w = h
m.z = b
a.u = j
a.p = g
assert f.s.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: E = None
        self.t: E = None
        self.s: C = None
        self.y: E = None
        self.o: F = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
g = C("g")
f = D("f")
j = E("j")
m = F("m")
a = B("a")

h.r = g
h.y = f
h.x = a
b.u = j
b.p = g
g.r = h
g.o = m
g.t = j
g.p = j
g.w = b
f.p = a
f.z = j
f.t = j
f.y = j
f.s = g
f.o = m
j.v = m
j.y = m
j.t = h
j.w = h
m.z = b
a.u = j
a.p = g
assert f.s.w.u.v.txt == "m"